package org.huangrui.spark.java.sql;

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SaveMode;
import org.apache.spark.sql.SparkSession;

/**
 * @Author hr
 * @Create 2024-10-20 19:39
 */
public class SparkSQL06_Source_Parquet {
    public static void main(String[] args) {
        SparkSession spark = SparkSession.builder().appName("SparkSQL05_Source_JSON").master("local[*]").getOrCreate();

        spark.read().parquet("data/users.parquet").show();
        final Dataset<Row> json = spark.read().json("data/user.json");

        json.write().mode(SaveMode.Overwrite).parquet("output");
        json.write().mode(SaveMode.Append).csv("output");



        spark.stop();
    }
}
